package com.mia.props.common;

import java.awt.Color;
import java.util.Locale;

public class ColorsUtil {
   public static Color parseColor(String s) {
      Color returnColor = null;
      s = s.trim().toLowerCase(Locale.US);

      try {
         returnColor = ColorsUtil.NamedColors.valueOf(s).getColor();
      } catch (IllegalArgumentException var9) {
      }

      if (returnColor == null) {
         if (s.startsWith("0x")) {
            String hex = s.substring(2);
            if (hex.length() == 3 || hex.length() == 4) {
               StringBuilder newHex = new StringBuilder();
               char[] var4 = hex.toCharArray();
               int var5 = var4.length;

               for(int var6 = 0; var6 < var5; ++var6) {
                  char c = var4[var6];
                  newHex.append(c);
                  newHex.append(c);
               }

               hex = newHex.toString();
            }

            if (hex.length() != 6 && hex.length() != 8) {
               throw new NumberFormatException("Invalid hex format detected while attempting to parse color value: " + s);
            }

            returnColor = new Color(Integer.parseInt(hex, 16));
            if (hex.length() == 8) {
               returnColor = new Color(returnColor.getRed(), returnColor.getGreen(), returnColor.getBlue(), Integer.parseInt(hex.substring(0, 2), 16));
            }
         } else {
            try {
               returnColor = new Color(Integer.parseInt(s));
            } catch (Exception var8) {
               throw new NumberFormatException("Invalid integer format detected while attempting to parse color value: " + s);
            }
         }
      }

      return returnColor;
   }

   public static enum NamedColors {
      aliceblue(15792383),
      antiquewhite(16444375),
      aqua(65535),
      aquamarine(8388564),
      azure(15794175),
      beige(16119260),
      bisque(16770244),
      black(0),
      blanchedalmond(16772045),
      blue(255),
      blueviolet(9055202),
      brown(10824234),
      burlywood(14596231),
      cadetblue(6266528),
      chartreuse(8388352),
      chocolate(13789470),
      coral(16744272),
      cornflowerblue(6591981),
      cornsilk(16775388),
      crimson(14423100),
      cyan(65535),
      darkblue(139),
      darkcyan(35723),
      darkgoldenrod(12092939),
      darkgray(11119017),
      darkgreen(25600),
      darkkhaki(12433259),
      darkmagenta(9109643),
      darkolivegreen(5597999),
      darkorange(16747520),
      darkorchid(10040012),
      darkred(9109504),
      darksalmon(15308410),
      darkseagreen(9419919),
      darkslateblue(4734347),
      darkslategray(3100495),
      darkturquoise(52945),
      darkviolet(9699539),
      deeppink(16716947),
      deepskyblue(49151),
      dimgray(6908265),
      dodgerblue(2003199),
      firebrick(11674146),
      floralwhite(16775920),
      forestgreen(2263842),
      fuchsia(16711935),
      gainsboro(14474460),
      ghostwhite(16316671),
      gold(16766720),
      goldenrod(14329120),
      gray(8421504),
      green(32768),
      greenyellow(11403055),
      honeydew(15794160),
      hotpink(16738740),
      indianred(13458524),
      indigo(4915330),
      ivory(16777200),
      khaki(15787660),
      lavender(15132410),
      lavenderblush(16773365),
      lawngreen(8190976),
      lemonchiffon(16775885),
      lightblue(11393254),
      lightcoral(15761536),
      lightcyan(14745599),
      lightgoldenrodyellow(16448210),
      lightgray(13882323),
      lightgreen(9498256),
      lightpink(16758465),
      lightsalmon(16752762),
      lightseagreen(2142890),
      lightskyblue(8900346),
      lightslategray(7833753),
      lightsteelblue(11584734),
      lightyellow(16777184),
      lime(65280),
      limegreen(3329330),
      linen(16445670),
      magenta(16711935),
      maroon(8388608),
      mediumaquamarine(6737322),
      mediumblue(205),
      mediumorchid(12211667),
      mediumpurple(9662683),
      mediumseagreen(3978097),
      mediumslateblue(8087790),
      mediumspringgreen(64154),
      mediumturquoise(4772300),
      mediumvioletred(13047173),
      midnightblue(1644912),
      mintcream(16121850),
      mistyrose(16770273),
      moccasin(16770229),
      navajowhite(16768685),
      navy(128),
      oldlace(16643558),
      olive(8421376),
      olivedrab(7048739),
      orange(16753920),
      orangered(16729344),
      orchid(14315734),
      palegoldenrod(15657130),
      palegreen(10025880),
      paleturquoise(11529966),
      palevioletred(14381203),
      papayawhip(16773077),
      peachpuff(16767673),
      peru(13468991),
      pink(16761035),
      plum(14524637),
      powderblue(11591910),
      purple(8388736),
      rebeccapurple(6697881),
      red(16711680),
      rosybrown(12357519),
      royalblue(4286945),
      saddlebrown(9127187),
      salmon(16416882),
      sandybrown(16032864),
      seagreen(3050327),
      seashell(16774638),
      sienna(10506797),
      silver(12632256),
      skyblue(8900331),
      slateblue(6970061),
      slategray(7372944),
      snow(16775930),
      springgreen(65407),
      steelblue(4620980),
      tan(13808780),
      teal(32896),
      thistle(14204888),
      tomato(16737095),
      turquoise(4251856),
      violet(15631086),
      wheat(16113331),
      white(16777215),
      whitesmoke(16119285),
      yellow(16776960),
      yellowgreen(10145074),
      mc_stone(8224125),
      mc_grass_block(4681022),
      mc_dirt(8806467),
      mc_podzol(5914396),
      mc_cobblestone(8026746),
      mc_oak_wood_planks(10256206),
      mc_spruce_wood_planks(6769966),
      mc_birch_wood_planks(12825467),
      mc_jungle_wood_planks(10120781),
      mc_acacia_wood_planks(11098931),
      mc_dark_oak_wood_planks(4007698),
      mc_oak_sapling(4679205),
      mc_spruce_sapling(3357217),
      mc_birch_sapling(7771732),
      mc_jungle_sapling(3167762),
      mc_acacia_sapling(7500564),
      mc_dark_oak_sapling(3692060),
      mc_bedrock(5460819),
      mc_water(3032052),
      mc_lava(13916690),
      mc_sand(14406560),
      mc_red_sand(11098145),
      mc_gravel(8289402),
      mc_gold_ore(9407356),
      mc_iron_ore(8880766),
      mc_coal_ore(7566195),
      mc_oak_wood(10124621),
      mc_spruce_wood(6836528),
      mc_birch_wood(12101241),
      mc_jungle_wood(10057289),
      mc_acacia_wood(10115904),
      mc_dark_oak_wood(5127721),
      mc_oak_leaves(2310683),
      mc_spruce_leaves(2112793),
      mc_birch_leaves(2310683),
      mc_jungle_leaves(3036705),
      mc_acacia_leaves(2310683),
      mc_dark_oak_leaves(2310683),
      mc_sponge(11974201),
      mc_glass(14348532),
      mc_lapis_lazuli_ore(6713478),
      mc_lapis_lazuli_block(2507657),
      mc_dispenser(6316128),
      mc_sandstone(14340766),
      mc_note_block(6570802),
      mc_booster_track(8678472),
      mc_detector_track(7890265),
      mc_sticky_piston(6316128),
      mc_cobweb(14474460),
      mc_grass(3692081),
      mc_fern(3823922),
      mc_dead_bush(8081177),
      mc_wool(14540253),
      mc_orange_wool(14384446),
      mc_magenta_wool(11751612),
      mc_light_blue_wool(6982345),
      mc_yellow_wool(11642407),
      mc_lime_wool(4304440),
      mc_pink_wool(13665433),
      mc_gray_wool(4210752),
      mc_light_gray_wool(10133921),
      mc_cyan_wool(3042953),
      mc_purple_wool(8273333),
      mc_blue_wool(3029133),
      mc_brown_wool(5190175),
      mc_green_wool(3491355),
      mc_red_wool(9843760),
      mc_black_wool(1644054),
      mc_dandelion(7119360),
      mc_poppy(6568196),
      mc_blue_orchid(2463882),
      mc_allium(11636179),
      mc_azure_bluet(10665866),
      mc_red_tulip(6784806),
      mc_orange_tulip(6260256),
      mc_white_tulip(6199617),
      mc_pink_tulip(6657609),
      mc_oxeye_daisy(11584907),
      mc_mushroom_brown(9070931),
      mc_mushroom_red(12793144),
      mc_block_gold(16378958),
      mc_block_iron(14408667),
      mc_stone_slab(10461087),
      mc_bricks_slab(9593686),
      mc_stone_bricks_slab(8026746),
      mc_nether_brick_slab(2889242),
      mc_quartz_slab(15526370),
      mc_tnt(8536367),
      mc_moss_stone(6781287),
      mc_obsidian(1315357),
      mc_torch(8546874),
      mc_fire(13863989),
      mc_monster_spawner(1713969),
      mc_diamond_ore(8490127),
      mc_block_diamond(6413269),
      mc_crafting_table(7030570),
      mc_farmland(7555885),
      mc_ladder(7954228),
      mc_track(7957592),
      mc_lever(6969664),
      mc_redstone_ore(8678251),
      mc_redstone_torch(10963753),
      mc_snow(15727611),
      mc_ice(8236543),
      mc_cactus(877336),
      mc_clay(10396848),
      mc_jukebox(7031095),
      mc_pumpkin(12613141),
      mc_netherrack(7288372),
      mc_soul_sand(5521459),
      mc_glowstone(9401925),
      mc_portal(5704383),
      mc_trapdoor(8281389),
      mc_mossy_stone_brick_monster_egg(7501674),
      mc_cracked_stone_brick_monster_egg(7763574),
      mc_chiseled_stone_brick_monster_egg(7763574),
      mc_mushroom_block(13282168),
      mc_iron_bars(7171178),
      mc_melon(9935140),
      mc_vines(2051850),
      mc_mycelium(7299945),
      mc_lily_pad(998166),
      mc_enchantment_table(6766651),
      mc_end_portal(5862752),
      mc_end_stone(14540709),
      mc_dragon_egg(788751),
      mc_redstone_lamp(4598554),
      mc_cocoa(9523230),
      mc_emerald_ore(7176308),
      mc_tripwire_hook(9077105),
      mc_block_emerald(5364085),
      mc_command_block(11700591),
      mc_beacon(7658967),
      mc_carrots(109328),
      mc_potatoes(109328),
      mc_anvil(4210752),
      mc_daylight_sensor(8549470),
      mc_block_redstone(11213577),
      mc_nether_quartz_ore(8213583),
      mc_hopper(4539717),
      mc_quartz(15197403),
      mc_pillar_quartz_block(15263197),
      mc_activator_track(6837063),
      mc_white_stained_clay(13742753),
      mc_orange_stained_clay(10572581),
      mc_magenta_stained_clay(9787500),
      mc_light_blue_stained_clay(7433353),
      mc_yellow_stained_clay(12223779),
      mc_lime_stained_clay(6780212),
      mc_pink_stained_clay(10571342),
      mc_gray_stained_clay(3746339),
      mc_light_gray_stained_clay(8874593),
      mc_cyan_stained_clay(5659483),
      mc_purple_stained_clay(7751254),
      mc_blue_stained_clay(4864859),
      mc_brown_stained_clay(5059363),
      mc_green_stained_clay(5002026),
      mc_red_stained_clay(9387310),
      mc_black_stained_clay(2430480),
      mc_hay_bale(11045648),
      mc_hardened_clay(9854018),
      mc_block_coal(1184274),
      mc_packed_ice(10863349),
      mc_sunflower(4287787),
      mc_lilac(9344132),
      mc_double_tallgrass(8026746),
      mc_large_fern(8092539),
      mc_rose_bush(4538371),
      mc_peony(3561531),
      mc_white_stained_glass(16777215),
      mc_orange_stained_glass(14188339),
      mc_magenta_stained_glass(11685080),
      mc_light_blue_stained_glass(6724056),
      mc_yellow_stained_glass(15066419),
      mc_lime_stained_glass(8375321),
      mc_pink_stained_glass(15892389),
      mc_gray_stained_glass(5000268),
      mc_light_gray_stained_glass(10066329),
      mc_cyan_stained_glass(5013401),
      mc_purple_stained_glass(8339378),
      mc_blue_stained_glass(3361970),
      mc_brown_stained_glass(6704179),
      mc_green_stained_glass(6717235),
      mc_red_stained_glass(10040115),
      mc_black_stained_glass(1644825);

      private Color c;

      private NamedColors(int hex) {
         this.c = new Color(hex);
      }

      final Color getColor() {
         return this.c;
      }
   }
}
